/*
验证:
带参数类成员,初始化

 */

#include <iostream>
using namespace std;

class A
{
public:
    A(int x, int y)
    {
        a = x;
        b = y;
    }
    ~A()
    {
        cout << "~A" << endl;
    }
    void show()
    {
        cout << "a: " << a << ",b: " << b << endl;
    }

private:
    int a;
    int b;
};

int main(int argc, char **argv)
{
    A *a1 = new A(2, 3);
    A *a2 = new A(10, 20);

    a1->show();
    a2->show();

    delete a1;
    delete a2;
    a1->show(); // a1 指向一个地址(之前的地址), a: 0,b: 0
    a2->show(); // a2 指向一个地址(之前的地址), a: -770150736,b: 21951

    return 0;
}
/*
1. delete 不会设置ptr 为nullptr, 只是释放内存
2. ptr 指向之前的地址
 */